<?php $__env->startSection('content'); ?>

    <div class="admin-content">
        <div class="admin-content-body">
            <div class="am-cf am-padding am-padding-bottom-0">
                <div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">企业管理</strong> /
                    <small>List</small>
                </div>
            </div>
            <?php echo $__env->make('admin._flash', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
            <hr>

            <div class="am-g">
                <div class="am-u-sm-12 am-u-md-6">
                    <div class="am-btn-toolbar">
                        <div class="am-btn-group am-btn-group-s">
                            <a href="/admin/recustomer/create" type="button" class="am-btn am-btn-default"><span
                                        class="am-icon-plus"></span> 新增</a>
                            
                            
                            


                        </div>
                    </div>
                </div>
            </div>
            <div class="am-g">
                <div class="am-u-sm-12 am-u-md-12">
                    <form class="am-form-inline" method="get">
                        <div class="am-form-group">
                            <div class="am-input-group am-input-group-sm">
                                <input type="text" class="am-form-field" name="name"
                                       value="<?php echo e(Request::input('name')); ?>" placeholder="企业名搜索">
                            </div>


                            <select data-am-selected="{btnSize: 'sm', maxHeight: 360, searchBox: 1}"
                                    name="store_id">
                                <option value="-1">所有门店</option>
                                <?php $__currentLoopData = $cates; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $c): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <option value="<?php echo e($c->id); ?>"
                                <?php if(Request::input('store_id')==$c->id): ?> selected <?php endif; ?>><?php echo e($c->name); ?></option>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                            </select>
                        </div>

                        <div class="am-form-group" style="margin-top: 3px">
                            <button type="submit" class="am-btn am-btn-default am-btn-sm">查询</button>
                            <a href="/admin/recustomer" class="am-btn am-btn-default am-btn-sm">重置</a>
                        </div>
                    </form>
                </div>

            </div>
            <hr>


            <div class="am-g">
                <div class="am-u-sm-12">
                    <form class="am-form">
                        <table class="am-table am-table-striped am-table-hover table-main">
                            <thead>
                            <tr style="font-size: 1.6rem">
                                <th><input class="check_all" type="checkbox"></th>
                                <th class="table-id">ID</th>
                                <th class="table-thumb">企业名</th>
                                <th class="table-type">联系人姓名</th>
                                <th class="table-type">联系人电话</th>
                                <th class="table-type">余额</th>
                                <th class="table-type">可同时在店</th>
                                <th class="table-type">到店次数</th>
                                <th class="table-type">套餐开通时间</th>
                                <th class="table-type">套餐到期时间</th>
                                <th class="table-type">是否可用</th>
                                <th class="table-type">绑定成员</th>
                                <th class="table-type"style="width: 90px">绑定员工消费记录</th>
                                <th class="table-type">加入Key</th>
                                <th class="table-type">更新Key</th>
                                <th class="table-type">发送Key</th>
                                <th class="table-set">操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            <?php $__currentLoopData = $cs; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $k=> $c): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <tr data-id="<?php echo e($c->id); ?>" style="font-size: 1.6rem">
                                    <th><input class="checked_id" name="checked_id[]" value="" type="checkbox"></th>
                                    <td><?php echo e($k+1); ?></td>

                                    <td>

                                            <?php echo e($c->name); ?>


                                    </td>

                                    <td>
                                        <?php echo e($c->linkman_name); ?>

                                    </td>
                                    <td class="am-hide-sm-only">
                                        <label class=" am-btn-secondary am-btn-s am-radius">
                                            <?php echo e($c->linkman_tel); ?>

                                        </label>
                                    </td>

                                    <td>
                                           <?php echo e($c->money); ?>元
                                    </td>
                                    <td>
                                        <?php echo e($c->staff_number); ?>人
                                    </td>
                                    <td>

                                        <label class=" am-btn-secondary am-btn-s am-radius">
                                            <?php echo e($c->come_time); ?>次
                                        </label>

                                    </td>


                                    <td>
                                        <?php echo e($c->start_at); ?>

                                    </td>
                                    <td>
                                        <?php echo e($c->end_at); ?>

                                    </td>

                                    <?php if(strtotime($c->end_at) - time()>0): ?>
                                        <td>
                                            <label class=" am-btn-success am-btn am-btn-xs am-radius">
                                                是
                                            </label>

                                        </td>
                                    <?php endif; ?>
                                    <?php if(strtotime($c->end_at) - time()<=0): ?>
                                        <td>
                                            <label class=" am-btn-danger am-btn am-btn-xs am-radius">
                                                否
                                            </label>

                                        </td>
                                    <?php endif; ?>

                                    <td>
                                        <a href="/admin/oncustomer?company_id=<?php echo e($c->id); ?>"> <label class="am-btn-danger am-btn am-btn-xs am-radius ">
                                                查看
                                            </label></a>
                                    </td>

                                    <td>
                                        <a href="/admin/order/order?company_id=<?php echo e($c->id); ?>&pay_way=4"> <label class="am-btn-danger am-btn am-btn-xs am-radius ">
                                                查看
                                            </label></a>
                                    </td>
                                    <td>
                                        <label class=" am-btn-default am-btn-s am-radius">
                                            <?php echo e($c->key); ?>

                                        </label>
                                    </td>

                                    <td>
                                        <label class="am-btn-danger am-btn am-btn-xs am-radius gx">
                                            更新
                                        </label>
                                    </td>
                                    <td>
                                        <label class="am-btn-danger am-btn am-btn-xs am-radius gxx">
                                            发送
                                        </label>
                                    </td>
                                    <td>
                                        <div class="am-btn-toolbar">
                                            <div class="am-btn-group am-btn-group-xs">

                                                <a href="/admin/recustomer/showplan/<?php echo e($c->id); ?>"
                                                   class="am-btn am-btn-success am-btn-xs"><span
                                                            class="am-icon-pencil-square-o"></span> 续开或更换套餐
                                                </a>
                                                <a href="/admin/recustomer/deposit/<?php echo e($c->id); ?>"
                                                   class="am-btn am-btn-default am-btn-xs"><span
                                                            class="am-icon-pencil-square-o"></span> 余额充值
                                                </a>

                                                <a href="/admin/recustomer/<?php echo e($c->id); ?>/edit"
                                                   class="am-btn am-btn-primary am-btn-xs"><span
                                                            class="am-icon-pencil-square-o"></span> 编辑
                                                </a>

                                                <a href="/admin/recustomer/<?php echo e($c->id); ?>"
                                                   data-method="delete"
                                                   data-token="<?php echo e(csrf_token()); ?>" data-confirm="确认删除吗?"
                                                   class="am-btn am-btn-danger am-btn-xs del_one">
                                                    <span class="am-icon-trash-o"></span> 删除
                                                </a>
                                            </div>
                                        </div>
                                    </td>
                                </tr>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>


                            </tbody>
                        </table>
                        共 <?php echo e($cs->total()); ?> 条记录

                        <div class="am-cf">
                            <div class="am-fr">
                                <?php echo $cs->appends(Request::all())->links(); ?>

                            </div>
                        </div>
                        <hr/>
                        <p>注：.....</p>
                    </form>
                </div>

            </div>
        </div>

        <footer class="admin-content-footer">
            <hr>
            <p class="am-padding-left">© 2014 AllMobilize, Inc. Licensed under MIT license.</p>
        </footer>

    </div>


<?php $__env->stopSection(); ?>
<?php $__env->startSection('js'); ?>
    <script>
        $(function () {

            //改变性别
            $('.gx').click(function () {
                //   alert(111);

                var id = $(this).parents('tr').data('id');
// console.log(id);exit;
                var _this = $(this);
                $.ajax({
                    type: 'PATCH',
                    url: '/admin/recustomer/change_key',
                    data: {id: id},
                    success: function () {
                        // _this.toggleClass('am-icon-male am-icon-female');
                        location.href = location.href;

                    }
                })

            })

            $('.gxx').click(function () {
                //   alert(111);

                var id = $(this).parents('tr').data('id');
// console.log(id);exit;
                var _this = $(this);
                $.ajax({
                    type: 'PATCH',
                    url: '/admin/recustomer/sendSms',
                    data: {id: id},
                    success: function (res) {
                        // _this.toggleClass('am-icon-male am-icon-female');
                       if(res==1){
                           alert('发送成功')
                       }

                    }
                })

            })
        })
    </script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts.admin.application', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>